#region Usings

using System;
using System.Collections.Generic;
using Castle.ActiveRecord;
using Karma.Framework.Core.Domain;

#endregion

namespace Karma.Framework.Core.Metadata.Mapping
{
    [ActiveRecord("[Query]")]
    public class Query : DomainObject
    {
        [JoinedKey]
        public override Int64 Id { get; set; }

        [Property(NotNull = true)]
        public string Name { get; set; }

        [Property(ColumnType = "StringClob", SqlType = "text")]
        public string Consulta { get; set; }

        [Property("[LinkQuery]", NotNull = true)]
        public bool LinkQuery { get; set; }

        [HasMany(typeof(Parameter), Cascade = ManyRelationCascadeEnum.All, Lazy = false,
            ColumnKey = "[Query]", Table = "[Parameter]")]
        public IList<Parameter> Parametros { get; set; }

        [HasMany(typeof(Column), Cascade = ManyRelationCascadeEnum.All, Lazy = false,
            ColumnKey = "[Query]", Table = "[Column]")]
        public IList<Column> Columns { get; set; }
    }
}